<!DOCTYPE html>
<html lang="zh_CN">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script type="text/javascript">

    var people = {
        username: '李阳',
        age: 12,
        height: 175,
        weight: '65kg',
        eduction: '本科',

        run: function () {
            console.log(this.username, '我能跑步');
        },
        sing: function () {
            console.log(this.username, '我能唱歌');
        }
    };
    /*
    * 对对象属性的增删改查操作
    * 1. 增加属性
    * 2. 查看属性
    * 3. 删除属性
    * 4. 修改属性
    * */

    people.worker = '程序猿';
    var name = 'fuse';
    people[name] = '黄种人';

    /*
    * 查看属性：
    * 1.单个查看
    *   对象变量.属性
    *   对象变量['属性字符串']
    *   对象变量[数组字符串变量]
    *
    * 2. 遍历查看
    *   for...in
    * */

    console.log('单个属性值的获取');
    console.log(people.username);

    console.log(people['age']);

    var name = 'height';
    console.log(people[name]);
    console.log('属性的遍历');
    for (var attr in people) {
        console.log('属性', attr, ' 属性的值', people[attr]);
    }

</script>

</html>
